package me.wangshier.security.web;

import me.wangshier.security.data.service.OrderAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author: tongqianwen
 * @Date: 2024/12/15
 */
@Controller
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private OrderAdminService adminService;
    @GetMapping
    public String showAdminPage() {
        return "admin";
    }

    @PostMapping("/deleteOrders")
    public String deleteAllOrders() {
        adminService.deleteAllOrders();
        return "redirect:/admin";
    }
}
